<template>
  <div class="viewcart">
    <!-- <div class="cart1">
      <span class="yhq">优惠券</span>
    </div> -->
    <div class="List">
      <dt @click="Info(item)" v-if="List.length>0" v-for="(item,index) in List" :key="index">
            <div class="flex_s">
                <text class="tip1">{{item.title}}</text>
                <text v-if="item.type == 1" class="tip1 green">+{{item.depositAmountChange}}</text>
                <text v-if="item.type != 1" class="tip1 red">{{item.depositAmountChange}}</text>
            </div>
              <div class="flex_s">
                <text class="tip2">{{item.depositTime}}</text>
                <div style="display: flex;justify-content: space-between;">
                  <text class="tip2">详情</text>
                  <img src="https://klcx-bucket.oss-cn-beijing.aliyuncs.com/klcx-xcx/ico/see.png" style="margin-left:10rpx;width:14rpx;height:24rpx">
                </div>

              </div>
        </dt>

      <div class="view nocart" v-if="List.length<1" :style="{'height':pageHeight-40 +'px'}">
        <div>
          <img src="https://klcx-bucket.oss-cn-beijing.aliyuncs.com/klcx-xcx/ico/nodata.png" style="width:80rpx;height:80rpx"/>
          <div class="tip2">暂无押金</div>
        </div>

      </div>

    </div>
    </div>

</template>

<script>
  import Service from '@/utils/service'

  export default {

    data() {
      return {
        isPass: true,
        pageHeight: null,
        List: [],
        page: 1
      }
    },

    mounted() {

    },
    onLoad() {
      this.pageHeight = wx.getSystemInfoSync().windowHeight
      this.List = []
      this.page=1
      this.getList(1)
    },
    onReachBottom() {
      this.getList(this.page)
    },
    methods: {
      Info(item){
        let list =JSON.stringify(item)
         wx.navigateTo({
          url: `../cashInfo/main?params=`+list
        })
      },
      getList(page) {
        const params = {pageNum: page, pageSize: 10}
        const that = this
        Service.depositList(params)
          .then((res) => {
            if (res.code == 200) {
              if (res.data.depositList) {
                var arr = this.List
                for (var i = 0; i < res.data.depositList.length; i++) {
                  arr.push(res.data.depositList[i])
                }
                this.List = arr
                if (res.data.depositList.length > 0) {
                  this.page++;
                }
              }
            }
          })
      },
    }
  }
</script>

<style scoped>
  .view {
    text-align: center;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
  }

  .nocart {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .flex_s {
    display: flex;
    justify-content:space-between;
    padding: 15px
  }
  .viewcart{
    height: 100vh;
    background: #F2F2F2;
    position: relative;
    left: 0;
  }

  .tip1 {
    font-size: 30px;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color: #333;
    line-height: 33px;
  }

  .tip2 {
    font-size: 28px;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color:#999;
    line-height: 27px;
  }

  .tx1 {
    font-size: 28px;
    color: #333;
  }

  .tx2 {
    font-size: 80px;
    color: #333;
  }

  .tx3 {
    font-size: 28px;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
    line-height: 29px;
  }

  .cart1 {
    position: relative;
  }

  .yhq {
    line-height: 100px;
    font-size: 30px;
    background: #fff;
    margin-left: 50px;
  }

  .yhq:after {

    margin-bottom: 0;
    content: '';
    position: absolute;
    width: 60px;
    height: 6px;
    left: 60px;
    bottom: 0;
    background-color: #FED130;
  }

  .List {
    position: relative;
    width: 100%;
    height: 100vh;
    background: rgba(246, 246, 246, 1);
    box-sizing: border-box;
    padding: 20px
  }

  .quanbg {
    width: 670px;
    height: 240px;

  }

  .List dt {
    position: relative;
    margin-bottom: 30px;
    background: #fff;
    margin: 20px auto;
    padding: 30px;
  }

  .List dt:last-child {
    margin-bottom: 0;
  }
   .List dt:first-child {
    margin-top: 0;
  }

  .textfont {
    position: absolute;
    left: 30px;
    top: 40px;
    z-index: 99;
  }

  .overDate {
    width: 200px;
    height: 200px;
    position: absolute;
    z-index: 100;
    right: 170px;
    top: 40px;
  }
  .red{
    color: #FF5B39
  }
  .green{
    color: #26C319
  }

  .none {
    width: 88px;
    height: 61px;
    text-align: center;
    margin-bottom: 20px;
  }


</style>
